package beanstao.util;


/**
 * 一个为了返回多个的值的封装类，一般由一个Boolean值和一个结果Object组成
 * @author beanstao@google.com 
 *
 */
public class TryValue
{
	private boolean _Boolean;
	private Object _Object;

	public boolean getBoolean()
	{
		return this._Boolean;
	}
	public void setBoolean(boolean flag)
	{
		this._Boolean = flag;
	}
	public Object getObject()
	{
		return this._Object;
	}
	public void setObject(Object object)
	{
		this._Object = object;
	}

	@Override
	public String toString()
	{
		return "TryObj [_Boolean=" + this._Boolean + ", _Object=" + this._Object + "]";
	}

	@Override
	public int hashCode()
	{
		final int prime = 31;
		int result = 1;
		result = prime * result + (this._Boolean ? 1231 : 1237);
		result = prime * result + ((this._Object == null) ? 0 : this._Object.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj)
	{
		if (this == obj)
		{
			return true;
		}
		if (obj == null)
		{
			return false;
		}
		if (this.getClass() != obj.getClass())
		{
			return false;
		}
		TryValue other = (TryValue) obj;
		if (this._Boolean != other._Boolean)
		{
			return false;
		}
		if (this._Object == null)
		{
			if (other._Object != null)
			{
				return false;
			}
		}
		else if (!this._Object.equals(other._Object))
		{
			return false;
		}
		return true;
	}
}
